#ifndef CONSTANTS_H
#define CONSTANTS_H

// times in microsecond
const int T_SLOT = 9;
const int T_SIFS = 10;
const int T_PIFS = 19;
const int T_DIFS = 28;
const int T_PROP = 1;		// Propogation time
const int T_CONTENTION = 2  /*propogation*/ + 6 /*128 point fft*/;
const int T_SFC = T_CONTENTION;
const int T_RFC = T_CONTENTION;
const int T_FCON = T_CONTENTION;
const int T_RTS = 26;
const int T_CTS = 26;
const int T_ACK = 26;

const int T_DATA = 0;		// calculate on line
const int T_NAVRTS_BASE = /*T_RTS +*/ T_SIFS + T_CTS + T_SIFS + T_DATA + T_SIFS + T_ACK;
const int T_NAVCTS_BASE = /*T_CTS +*/ T_SIFS + T_DATA + T_SIFS + T_ACK;

// contention windows
const int CW_MIN = 32;
const int CW_MAX = 1024;

// packet size
const int DATA_PCK_SIZE = 1500 * 8;	// 1500B
const int CTS_PCK_SIZE = 14 * 8;	// 14B
const int RTS_PCK_SIZE = 20 * 8;	// 20B
const int ACK_PCK_SIZE = 14 * 8;	// 14B

// data rates
const int MBPS_6 = 6 * 1000 * 1000;
const int MBPS_18 = 16 * 1000 * 1000;
const int MBPS_36 = 26 * 1000 * 1000;
const int MBPS_54 = 54 * 1000 * 1000;

// nodes
const int MAX_NODE = 100;
const int MAX_NODE_IN_ONE_DOMAIN = 16;
const int MAX_ID = MAX_NODE_IN_ONE_DOMAIN;

// subcarriers
const int NUM_SUBCARRIER = 128;
const int NUM_ID_SUBCARRIER = MAX_ID;
const int NUM_CONT_SUBCARRIER = NUM_SUBCARRIER - NUM_ID_SUBCARRIER;

// simulation area
const int MAX_X = 50;
const int MAX_Y = 50;
const int COMM_RANGE = 15;
const int MAX_TRY = 10000000;

// states for CSMA/CA
const int STATE_IDLE = 0;
const int STATE_DIFS = 1;
const int STATE_CW = 2;
const int STATE_RTS = 3;
const int STATE_SIFS = 4;
const int STATE_CTS = 5;
const int STATE_DATA = 6;
const int STATE_ACK = 7;
const int STATE_NAV = 8;

// only for ACKCON
const int STATE_SFC = 9;	// sender frequency domain contension
const int STATE_RFC = 10;	// receiver freqeuncy domain contension only
const int STATE_SDATA = 11;		// send data
const int STATE_RDATA = 12;		// receive data
const int STATE_RACK = 13;		// receiver ack and contend in frequency domain
const int STATE_SACK = 14;		// sender wait for receiver ack and contend
const int STATE_SIFS1 = 15;
const int STATE_SIFS2 = 16;
const int STATE_SIFS3 = 17;

// only for T2F
const int STATE_ROUND1 = 18;
const int STATE_ROUND2 = 19;
const int STATE_WAIT = 20;
const int STATE_PIFS = 21;
const int STATE_WRDATA = 22;
const int STATE_WRACK = 23;
const int STATE_PRDATA = 24;
const int STATE_PRACK = 25;

#endif